package selenium;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

public class test13{

    public static void main(String[] args) {

    	WebDriver driver = new ChromeDriver();
    	String proxyIpAndPort= "59.56.225.168:49063";
    	  DesiredCapabilities cap = new DesiredCapabilities();
    	  Proxy proxy=new Proxy();
    	  proxy.setHttpProxy(proxyIpAndPort).setFtpProxy(proxyIpAndPort).setSslProxy(proxyIpAndPort);
    	  cap.setCapability(CapabilityType.ForSeleniumServer.AVOIDING_PROXY, true);
    	  cap.setCapability(CapabilityType.ForSeleniumServer.ONLY_PROXYING_SELENIUM_TRAFFIC, true);
    	  System.setProperty("http.nonProxyHosts", "localhost");
    	  cap.setCapability(CapabilityType.PROXY, proxy);
        try{
            driver.get("https://www.baidu.com/s?wd=ip");            
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}